/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package model;

/**
 *
 * @author moustafa
 */
public class Inventory {
    public static int QUANTITY_THRESHOLD = 5;
    private String id;
    private Warehouse warehouse;
    private Product product;
    private int quantity;

    public Inventory(Warehouse warehouse, Product product, int quantity){
        this.id = warehouse.getID() + "-" + product.getID();
        this.warehouse = warehouse;
        this.product = product;
        this.quantity = quantity;
    }

    public void setQuantity(int quantity) {
        this.quantity = quantity;
    }

    public Inventory(String id, int quantity){
        this.id = id;
        this.quantity = quantity;
    }

    public String getID(){
        return this.id;
    }

    public Product getProduct() {
        return product;
    }

    public int getQuantity() {
        return quantity;
    }

    public Warehouse getWarehouse() {
        return warehouse;
    }

    public int getWarehouseID() {
        return Integer.parseInt(id.substring(0, id.indexOf('-')));
    }

    public int getProductID() {
        return Integer.parseInt(id.substring(id.indexOf('-')+1));
    }


}
